<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>01-jQuery对象进行方法扩展</title>
    <script src="../js/jquery-3.3.1.min.js" type="text/javascript" charset="utf-8"></script>
    <script type="text/javascript">
        // 定义了check方法
        $.fn.extend({
            check:function () {
                this.prop("checked",true)
            },
            uncheck:function (){
                this.prop("checked",false)
            }
        })

        $(function () {
            $("#btn-check").click(function () {
                $(":checkbox").check()
            })

            $("#btn-uncheck").click(function () {
                $(":checkbox").uncheck()
            })
        })
    </script>
</head>
<body>
<input id="btn-check" type="button" value="点击选中复选框" onclick="checkFn()">
<input id="btn-uncheck" type="button" value="点击取消复选框选中" onclick="uncheckFn()">
<br/>
<input type="checkbox" value="football">足球
<input type="checkbox" value="basketball">篮球
<input type="checkbox" value="volleyball">排球

</body>
</html>

